package com.myidis.mapper;

import com.myidis.entity.*;
import com.myidis.request.DICalculatorReq;
import com.myidis.request.SearchReq;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

public interface CIResultMapper {

    @Select("SELECT * FROM ciresultslist}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "subject", column = "subject"),
            @Result(property = "calTime", column = "calTime"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "springDay", column = "springDay"),
            @Result(property = "calculator", column = "calculator"),
            @Result(property = "startTime", column = "startTime"),
            @Result(property = "endTime", column = "endTime")

    })
    ArrayList<IndexResultList> list();

    @Select("SELECT * FROM ciresults where listId = #{id}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "listId", column = "listId"),
            @Result(property = "time", column = "time"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "LeadDI", column = "LeadDI"),
            @Result(property = "CoinDI", column = "CoinDI"),
            @Result(property = "LagDI", column = "LagDI"),
            @Result(property = "BenchmarkDI", column = "BenchmarkDI")
    })
    ArrayList<FullCIResult> getData(IndexResultList sea);

    @Select("SELECT * FROM ciresultslist where id = #{id}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "subject", column = "subject"),
            @Result(property = "calTime", column = "calTime"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "springDay", column = "springDay"),
            @Result(property = "calculator", column = "calculator"),
            @Result(property = "startTime", column = "startTime"),
            @Result(property = "endTime", column = "endTime")

    })
    FullCIResult getInfo(int sea);

    @Insert("INSERT intO ciresults(listId, time, leadDI, CoinDI, LagDI, BenchmarkDI) VALUES( #{subject}, #{time}, #{leadDI}, " +
            "#{CoinDI}, #{LagDI},#{BenchmarkDI})")
    int insertDetail(FullCIResult set);

    @Insert("INSERT intO ciresultslist(id, springDay, calTime, combination, calculator, startTime, endTime) VALUES( #{id}, #{calTime}, " +
            "#{combination},#{springDay}, #{calculator}, #{startTime}, #{endTime})")
    int insertList(IndexResultList set);

    @Delete("DELETE FROM ciresults WHERE listId = #{id}")
    int deleteData(int id);

    @Delete("DELETE FROM ciresultslist WHERE id = #{id}")
    int delete(int id);


}
